package com.example.demo.com.example.singleton;

public class HangrySingleton {

    //2.对象不能被修改，与只能创建一次
    private static final HangrySingleton singleton = new HangrySingleton();

    //1.构造器私有化
    private HangrySingleton(){}

    //获取单例的时候直接用已创建的对象
    public static HangrySingleton getInstance(){
        return singleton;
    }
}
